/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.quickbi_public.transform.v20220101;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.quickbi_public.model.v20220101.ListDataSourceResponse;
import com.aliyuncs.quickbi_public.model.v20220101.ListDataSourceResponse.Data;
import com.aliyuncs.transform.UnmarshallerContext;


public class ListDataSourceResponseUnmarshaller {

	public static ListDataSourceResponse unmarshall(ListDataSourceResponse listDataSourceResponse, UnmarshallerContext _ctx) {
		
		listDataSourceResponse.setRequestId(_ctx.stringValue("ListDataSourceResponse.RequestId"));
		listDataSourceResponse.setSuccess(_ctx.booleanValue("ListDataSourceResponse.Success"));

		List<Data> result = new ArrayList<Data>();
		for (int i = 0; i < _ctx.lengthValue("ListDataSourceResponse.Result.Length"); i++) {
			Data data = new Data();
			data.setCreatorId(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].CreatorId"));
			data.setCreatorName(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].CreatorName"));
			data.setDatasourceId(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].DatasourceId"));
			data.setGmtCreate(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].GmtCreate"));
			data.setGmtModified(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].GmtModified"));
			data.setShowName(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].ShowName"));
			data.setDsType(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].DsType"));
			data.setParentDsType(_ctx.stringValue("ListDataSourceResponse.Result["+ i +"].ParentDsType"));

			result.add(data);
		}
		listDataSourceResponse.setResult(result);
	 
	 	return listDataSourceResponse;
	}
}